pynumaflow-lite: Pythonic APIs for unary/batchmap/mapstream#368
pynumaflow-lite: Pythonic APIs for unary/batchmap/mapstream#368BulkBeing wants to merge 5 commits into
Conversation
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #368 +/- ##
=======================================
Coverage 92.74% 92.74%
=======================================
Files 67 67
Lines 3540 3540
Branches 232 232
=======================================
Hits 3283 3283
Misses 191 191
Partials 66 66 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
Signed-off-by: Sreekanth <prsreekanth920@gmail.com>
|
Reviewed the diff - the callable-handler refactor looks good and matches #369: the ABCs are gone, handlers are typed as One minor, non-blocking observation: the validation runs at call time (per invocation, via |
Make the public APIs more Pythonic
related to: #369
Notable change - No more class inheritance. The handler is just an async function.
A simple example using a class would look like:
The
obj.handleris passed to the constructor.before the user had to do:
This PR changes the syntax for unary, batchmap, mapstream and sink.
Users can still pass the object directly if the handler method's name is
__call__(making the object callable):Since we only need a handler, the state can be in class or even in a closure: